﻿using Leo.Awesome.Attachment.MongoDb;
using Leo.Awesome.Attachment.Repositories;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
using Volo.Abp.Uow;

namespace Leo.Awesome.Attachment.MongoDB;

[DependsOn(
    typeof(AttachmentDomainModule)
)]
public class AttachmentMongoDbModule : AbpModule
{
    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        context.Services.AddMongoDbContext<AttachmentMongoDbContext>(options =>
        {
            options.AddDefaultRepositories();
            options.AddRepository<Attachment, AttachmentRepostiry>(); //Replaces IRepository<UnitOfMeasurementItemUseRecord, long>
        });

        Configure<AbpUnitOfWorkDefaultOptions>(options =>
        {
            options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled;
        });
    }
}
